Skip to content

Conversation

@Ashwinhegde19
Copy link
Contributor

Summary

Fix macOS/BSD compatibility in setup command.

Problem

The ls -lR -I 'node_modules' command fails on macOS/BSD because the -I flag is not supported. This causes node_modules to be scanned, leading to API token limit errors.

Solution

Replace with cross-platform find command that works on all systems.

Also added __pycache__ to exclusion list.

Fixes #11

The ls -lR -I flag is not supported on macOS/BSD systems, causing
setup to scan node_modules and hit token limits.

Replace with cross-platform find command that works on all systems.
Also added __pycache__ to the exclusion list.

Fixes gemini-cli-extensions#11
1. **Respect Ignore Files:** Before scanning any files, you MUST check for the existence of `.geminiignore` and `.gitignore` files. If either or both exist, you MUST use their combined patterns to exclude files and directories from your analysis. The patterns in `.geminiignore` should take precedence over `.gitignore` if there are conflicts. This is the primary mechanism for avoiding token-heavy, irrelevant files like `node_modules`.
2. **Efficiently List Relevant Files:** To list the files for analysis, you MUST use a command that respects the ignore files. For example, you can use `git ls-files --exclude-standard -co | xargs -n 1 dirname | sort -u` which lists all relevant directories (tracked by Git, plus other non-ignored files) without listing every single file. If Git is not used, you must construct a `find` command that reads the ignore files and prunes the corresponding paths.
3. **Fallback to Manual Ignores:** ONLY if neither `.geminiignore` nor `.gitignore` exist, you should fall back to manually ignoring common directories. Example command: `ls -lR -I 'node_modules' -I '.m2' -I 'build' -I 'dist' -I 'bin' -I 'target' -I '.git' -I '.idea' -I '.vscode'`.
3. **Fallback to Manual Ignores:** ONLY if neither `.geminiignore` nor `.gitignore` exist, you should fall back to manually ignoring common directories. Example command: `find . -type d \\( -name 'node_modules' -o -name '.m2' -o -name 'build' -o -name 'dist' -o -name 'bin' -o -name 'target' -o -name '.git' -o -name '.idea' -o -name '.vscode' -o -name '__pycache__' \\) -prune -o -type f -print | head -200`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, you should be able to take advantage of shell command templates: !{find . -type ... head -200}

See Gemini CLI docs for more details: https://geminicli.com/docs/cli/custom-commands/#3-executing-shell-commands-with

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/conductor setup fails with "token count exceeds maximum" (400) on large repositories

2 participants